﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; 

namespace DbSharp.Framework.Assertion.Xml
{
    class XmlAssertionFactory : IAssertionFactory
    {
        #region IAssertionFactory Members

        public IAssertion CreateAssertion(AssertionType assertionType)
        {
            IAssertion assertion;
            switch (assertionType.PrimitiveType)
            {
                case AssertPrimitiveType.NotCareResultset:
                    assertion = new NotCareResultsetAssertion();
                    break;
                case AssertPrimitiveType.SetEqual:
                    assertion = new SetEqualAssertion();
                    break;
                case AssertPrimitiveType.IsSupersetOf:
                    assertion = new IsSupersetOfAssertion();
                    break;
                case AssertPrimitiveType.IsProperSupersetOf:
                    assertion = new IsProperSupersetOfAssertion();
                    break;
                case AssertPrimitiveType.IsSubsetOf:
                    assertion = new IsSubsetOfAssertion();
                    break;
                case AssertPrimitiveType.IsProperSubsetOf:
                    assertion = new IsProperSubsetOfAssertion();
                    break;
                case AssertPrimitiveType.Overlaps:
                    assertion = new OverlapsAssertion();
                    break;

                case AssertPrimitiveType.DecimalElementIsInNumAxis:
                    assertion = new DecimalElementIsInNumAxisAssertion();
                    break;
                case AssertPrimitiveType.DecimalElementIsEqual:
                    assertion = new DecimalElementIsEqualAssertion();
                    break;
                case AssertPrimitiveType.DecimalElementIsGreater:
                    assertion = new DecimalElementIsGreaterAssertion();
                    break;
                case AssertPrimitiveType.DecimalElementIsGreaterOrEqual:
                    assertion = new DecimalElementIsGreaterOrEqualAssertion();
                    break;
                case AssertPrimitiveType.DecimalElementIsLess:
                    assertion = new DecimalElementIsLessAssertion();
                    break;

                case AssertPrimitiveType.DecimalElementIsLessOrEqual:
                    assertion = new DecimalElementIsLessOrEqualAssertion();
                    break;
                case AssertPrimitiveType.RecordCountIsInNumAxis:
                    assertion = new RecordCountIsInNumAxisAssertion();
                    break;
                case AssertPrimitiveType.RecordCountIsEqual:
                    assertion = new RecordCountIsEqualAssertion();
                    break;
                case AssertPrimitiveType.RecordCountIsGreater:
                    assertion = new RecordCountIsGreaterAssertion();
                    break;
                case AssertPrimitiveType.RecordCountIsGreaterOrEqual:
                    assertion = new RecordCountIsGreaterOrEqualAssertion();
                    break;
                case AssertPrimitiveType.RecordCountIsLess:
                    assertion = new RecordCountIsLessAssertion();
                    break;
                case AssertPrimitiveType.RecordCountIsLessOrEqual:
                    assertion = new RecordCountIsLessOrEqualAssertion();
                    break;
                case AssertPrimitiveType.StrictEqual:
                    assertion = new StrictEqualAssertion();
                    break;
                default:
                    assertion = new NotCareResultsetAssertion();
                    break;
            }

            if (assertionType.WithLogicNotMark)
                assertion = new LogicNotAssertion(assertion);

            return assertion;
        }


        #endregion
    }

}
